package com.mall.shopping.dto;

import com.mall.commons.result.AbstractRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *  ciggar
 * create-date: 2019/7/24-16:29
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AllProductRequest extends AbstractRequest {

    private Integer page;
    private Integer size;
    private String sort;
    private Long cid;
    private Integer priceGt;
    private Integer priceLte;

    @Override
    public void requestCheck() {
        if(page<=0){
            setPage(1);
        }
        //价格区间校验
        if (priceGt != null && priceLte != null) {
            if(priceGt > priceLte){
                Integer tmp =priceGt;
                priceGt=priceLte;
                priceLte=tmp;
            }
        }
    }
}
